﻿using System;
using System.Runtime.InteropServices;

namespace Padsurface.CoreAudio.MultiMediaStructures
{
    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 2)]
    public class WaveFormatExtensible : WaveFormatEx
    {
        /// <summary>
        /// Number of bits of precision in the signal. 
        /// Usually equal to BitsPerSample.
        /// </summary>
        public UInt16 ValidBitsPerSample;

        /// <summary>
        /// Number of samples contained in one compressed block of audio data. 
        /// This value is used in buffer estimation. 
        /// This value is used with compressed formats that have a fixed number of samples within each block. 
        /// This value can be set to 0 if a variable number of samples is contained in each block of compressed audio data. 
        /// In this case, buffer estimation and position information needs to be obtained in other ways.
        /// </summary>
        public UInt16 SamplesPerBlock;

        /// <summary>
        /// Reserved for internal use by operating system. 
        /// Set to 0.
        /// </summary>
        public UInt16 Reserved;

        /// <summary>
        /// Bitmask specifying the assignment of channels in the stream to speaker positions
        /// </summary>
        public UInt32 ChannelMask;

        /// <summary>
        /// Subformat of the data, such as KSDATAFORMAT_SUBTYPE_PCM. 
        /// The subformat information is similar to that provided by the tag in the WAVEFORMATEX structure's FormatTag member.
        /// </summary>
        public Guid SubFormat;
    }
}
